import qs from 'qs';

/**
 * 获取url参数
 * @returns {any}
 */
export function getUrlParams() {
  let search;
  if (window.location.search) {
    search = window.location.search.substring(1);
  } else if (window.location.hash) {
    search = window.location.hash.split('?')[1];
  }

  return qs.parse(search);
}

/**
 * 数组去重
 * @param arr
 * @returns {any[]}
 */
export function unique(arr) {
  return Array.from(new Set(arr));
}
